#pragma once

#include <iostream>
#include <string>
#include "IntAddr.hpp"
class TcpServer;
class Connection
{
public:
    Connection()
    {}

    virtual void Recver() = 0;
    virtual void Sender() = 0;
    virtual void Expecter() = 0;

    void SetEvent(uint32_t event)
    {
        _event = event; 
    }
    uint32_t GetEvent()
    {
        return _event;
    }
    void SetFd(int fd)
    {
        _sockfd = fd;
    }
    int GetFd()
    {
        return _sockfd;
    }
    
    ~Connection()
    {}

private:
    int _sockfd;

    //缓冲区
    std::string _inbuffer;
    std::string _outbuffer;

    //回指指针
    TcpServer *_owner;

    //client信息
    InetAddr _client_addr;

    //关心事件
    unit32_t _event;
};